package com.blackfish.admin;

import com.jfinal.aop.Interceptor;
import com.jfinal.aop.Invocation;
import com.jfinal.core.Controller;

import javax.servlet.http.HttpSession;

/**
 * �? demo 仅表达最为粗浅的 jfinal 用法，更为有价�?�的实用的企业级用法
 * 详见 JFinal 俱乐�?: http://jfinal.com/club
 * 
 * BlogInterceptor
 * 此拦截器仅做为示例展示，在本 demo 中并不需�?
 */
public class AdminInterceptor implements Interceptor {
	
	public void intercept(Invocation inv) {
		Controller clr = inv.getController();
		String isLogin = (String)clr.getSession().getAttribute("AdminLoginAction");

		if(isLogin!="Yes"){
			clr.redirect("/admin/login");
			return;
		}
		System.out.println("Before invoking " + inv.getActionKey());
		inv.invoke();
		System.out.println("After invoking " + inv.getActionKey());
	}
}
